using System;
using System.Collections.Generic;
using Dict.DataModel;

namespace Dict.Dao
{
    public class TableBootHeroDao:DaoBase<TableBootHero>
    {
        public override void AddPrimaryIndex(TableBootHero model)
        {
            cachePrimary[model.id.ToString()] = model;
        }

        public override string GetFileName()
        {
            return "TableBootHero.txt";
        }

        protected override TableBootHero ParseRowData(string[] rowData)
        {
            TableBootHero data = new TableBootHero();
			data.id = rowData [0];
			data.HeroId = rowData [1];

            if (string.IsNullOrEmpty(rowData[2]))
            {
                data.Camp = 0;
            }
            else
            {
                data.Camp = int.Parse(rowData[2]);
            }

            if (string.IsNullOrEmpty(rowData[3]))
            {
                data.Position = 0;
            }
            else
            {
                data.Position = int.Parse(rowData[3]);
            }

            if (string.IsNullOrEmpty(rowData[4]))
            {
                data.Level = 0;
            }
            else
            {
                data.Level = int.Parse(rowData[4]);
            }

            if (string.IsNullOrEmpty(rowData[5]))
            {
                data.Attack = 0;
            }
            else
            {
                data.Attack = int.Parse(rowData[5]);
            }

            if (string.IsNullOrEmpty(rowData[6]))
            {
                data.PhyDefend = 0;
            }
            else
            {
                data.PhyDefend = int.Parse(rowData[6]);
            }

            if (string.IsNullOrEmpty(rowData[7]))
            {
                data.MagicDefend = 0;
            }
            else
            {
                data.MagicDefend = int.Parse(rowData[7]);
            }

            if (string.IsNullOrEmpty(rowData[8]))
            {
                data.Hp = 0;
            }
            else
            {
                data.Hp = int.Parse(rowData[8]);
            }

            if (string.IsNullOrEmpty(rowData[9]))
            {
                data.hit = 0;
            }
            else
            {
                data.hit = double.Parse(rowData[9]);
            }

            if (string.IsNullOrEmpty(rowData[10]))
            {
                data.dodge = 0;
            }
            else
            {
                data.dodge = double.Parse(rowData[10]);
            }

            if (string.IsNullOrEmpty(rowData[11]))
            {
                data.cri = 0;
            }
            else
            {
                data.cri = double.Parse(rowData[11]);
            }

            if (string.IsNullOrEmpty(rowData[12]))
            {
                data.antiCri = 0;
            }
            else
            {
                data.antiCri = double.Parse(rowData[12]);
            }

            if (string.IsNullOrEmpty(rowData[13]))
            {
                data.criFactor = 0;
            }
            else
            {
                data.criFactor = double.Parse(rowData[13]);
            }

            if (string.IsNullOrEmpty(rowData[14]))
            {
                data.damageAdd = 0;
            }
            else
            {
                data.damageAdd = double.Parse(rowData[14]);
            }

            if (string.IsNullOrEmpty(rowData[15]))
            {
                data.damageReduce = 0;
            }
            else
            {
                data.damageReduce = double.Parse(rowData[15]);
            }
			data.SkillId1 = rowData [16];
			data.SkillId2 = rowData [17];
			data.UltSkillId = rowData [18];
			data.Talent0 = rowData [19];
			data.Talent1 = rowData [20];
			data.Talent2 = rowData [21];
			data.Talent3 = rowData [22];
			data.Talent4 = rowData [23];
			data.Talent5 = rowData [24];

            return data;
        }



    }

}
